package controller

import (
	"DouBan/utils/logger"
	"github.com/gin-gonic/gin"
	"net/http"
)

func responseWithError(context *gin.Context, key string, status int, msg string, err error) {
	logger.ErrorLn(key, "info", err.Error())
	context.JSON(status, gin.H{"status": 0, "msg": msg, "data": nil})
}

func responseWithSuccess(context *gin.Context, key string, msg string) {
	logger.InfoLn(key, "info", msg)
	context.JSON(http.StatusOK, gin.H{"status": 1, "msg": msg, "data": nil})
}
